<?php
declare(strict_types=1);

namespace app\admin\service;

use app\admin\model\ArticleCate as ArticleCateModel;

class ArticleCateService
{
    /**
     * 知识分类列表
     * @param $where
     * @param $page
     * @param $limit
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getArticleCateList($where, $page, $limit)
    {
        return ArticleCateModel::getArticleCateList($where, $page, $limit);
    }

    /**
     * 知识分类统计
     * @param $where
     * @return int
     */
    public static function countArticleCateList($where)
    {
        return ArticleCateModel::countArticleCateList($where);
    }


    /**
     * 获取指定知识分类
     * @param $where
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function findArticleCate($where)
    {
        return ArticleCateModel::findArticleCate($where);
    }

    /**
     * 知识分类更新
     * @param $data
     * @param $where
     * @return ArticleCateModel
     */
    public static function updateArticleCate($data, $where)
    {
        return ArticleCateModel::updateArticleCate($data, $where);
    }

    /**
     * 知识分类添加
     * @param $data
     * @return ArticleCateModel|\think\Model
     */
    public static function createArticleCate($data)
    {
        var_dump($data);
        return ArticleCateModel::createArticleCate($data);
    }

    /**
     * 所有知识分类
     * @return \think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getAllArticleCate()
    {
        return ArticleCateModel::getAllArticleCate();
    }

    /**
     * 知识分类名
     * @param $where
     * @return mixed
     */
    public static function findArticleCateName($where)
    {
        return ArticleCateModel::findArticleCateName($where);
    }
}